// components/button-count/button-count.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    num: Number
  },
  options: {
    styleIsolation: "page-shared"
  },

  /**
   * 组件的初始数据
   */
  data: {
    count: 0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onAdd() {
      // console.log(this)
      // this.setData({
      //   count: this.data.count + 1
      // })
      this.triggerEvent('update-count', this.properties.num + 1)
    }
  },
  observers: {
    count(val, old) {
      console.log('cont', val, old)
    }
  },
  lifetimes: {
    created() {
      console.log('created')
    },
    attached() {
      console.log('attached')

    },
    ready() {
      console.log('ready')

    },
    detached() {
      console.log('detached')

    }
  },
  // 组件在页面的生命周期
  pageLifetimes: {
    show() {
      console.log('button-show')
    },
    hide() {
      console.log('button-hide')

    },
    resize() {
      console.log('button-resize')

    }
  }
})
